/**
 * CopyRight © 2012 USTC SINOVATE SOFTWARE CO.LTD All Rights Reserved.
 */

package com.cmcc.zysoft.infocollection.mobile.dao;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.cmcc.zysoft.infocollection.model.SystemUser;
import com.starit.common.dao.hibernate.HibernateBaseDaoImpl;

/**
 * @author 袁凤建
 * <br />邮箱: yuan.fengjian@ustcinfo.com
 * <br />描述: MSystemUserSDao.java
 * <br />版本: 1.0.0
 * <br />日期: 2013-8-12 下午1:51:16
 * <br />CopyRight © 2012 USTC SINOVATE SOFTWARE CO.LTD All Rights Reserved.
 */

@Repository
public class MSystemUserDao extends HibernateBaseDaoImpl<SystemUser, String> {

	@Autowired
	private JdbcTemplate jdbcTemplate;
	
	/**
	 * 获取用户基本信息-姓名、部门名称、公司名称.
	 * @param usercode
	 * @return List<Map<String, Object>>
	 */
	public List<Map<String, Object>> getEmpInfo(String usercode) {
		String sql = 
				" SELECT employee.employee_name, b.department_name, c.company_name " +
				" FROM tb_c_employee employee, tb_c_system_user a, tb_c_department b, tb_c_company c " +
				" WHERE employee.employee_id = a.employee_id AND employee.department_id = b.department_id " +
				" AND c.company_id = a.company_id AND a.del_flag = '0' AND a.user_name = ?";
		return this.jdbcTemplate.queryForList(sql, usercode);
	}
}
